<#import "../macro/components.ftl" as components/>
<#include "../macro/layout_default.ftl"/>

<@head>

</@head>

<@body>
<script src="/misc/app/js/salesman_payrule_list.js"></script>
<script>var PicDomain = "${PicDomain!}"</script>
</@body>

<@layout_default>
<div class="box">
    <div class="box-header with-border">
        <span class="pull-right text-muted">共 ${pagelist.resultTotal} 条记录</span>
        <input type="hidden" id="resultTotal_hidden" value="${pagelist.resultTotal}" />
        <form class="form-inline" action="/salemanPayrule/searchList">
            <div class="input-group">
                <div class="input-group-addon">产品</div>
                <input type="text" class="form-control" style="width: 260px" name="prodct" value="${prodct!}" placeholder="名称或编码"/>
            </div>
            <div class="input-group">
                <div class="input-group-addon">适用区域</div>
                <input type="text" class="form-control" style="width: 260px" name="area" value="${area!}" placeholder="省-市-区"/>
            </div>
            <div class="input-group">
                <div class="input-group-addon">状态</div>
                <select class="form-control" name="state">
                    <option value="">全部</option>
                    <option value="0" ${(state?exists && state == 0)?string("selected","")}>未启用</option>
                    <option value="1" ${(state?exists && state == 1)?string("selected","")}>正常</option>
                    <option value="2" ${(state?exists && state == 2)?string("selected","")}>封存</option>
                </select>
            </div>

            <button type="submit" class="btn btn-warning"><i class="fa fa-search"></i> 查询</button>
        </form>
        <form class="form-inline hide">
            <input class="form-control"/>
            <input type="email" class="form-control"/>
            <button type="submit" class="btn btn-default">Send invitation</button>
        </form>
    </div>

    <!-- /.box-header -->
    <div class="box-body">
        <table class="table table-striped table-hover">
            <tr>
                <th>产品</th>
                <th>区域</th>
                <th>有效时间</th>
                <th>每日提现次数</th>
                <th>提现条件</th>
                <th>规则</th>
                <th>状态</th>
            </tr>

            <#if (pagelist.result?size > 0)>

                <#list pagelist.result as item>
                    <tr>
                        <td>${item.proName!}</td>
                        <td>${item.adname!}</td>
                        <td><#if item.valid_begin_time?exists>${item.valid_begin_time?number_to_date?string("yyyy-MM-dd HH:mm:ss")}至${item.valid_end_time?number_to_date?string("yyyy-MM-dd HH:mm:ss")}</#if></td>
                        <td>${item.day_limit}</td>
                        <td>
                            <#if item.pay_condition?exists>
                                <#if item.pay_condition == 1>
                                    ${item.pay_limit!}瓶
                                <#else >
                                    ￥${item.pay_limit!}
                                </#if>
                            </#if>
                        </td>
                        <td> ${item.name!}</td>

                        <td>
                            <#if item.state == 0><span class="text-red">未启用</span>
                            <#elseif item.state == 1><span class="text-green">正常</span>
                            <#else><span class="text-yellow">封存</span>
                            </#if>
                        </td>
                    </tr>
                </#list>
            <#else>
                <tr>
                    <td class="text-center text-muted" colspan="6"><i class="fa fa-info-circle"></i> 没有记录</td>
                </tr>
            </#if>


        </table>
        <table class="table table-striped table-hover">
            <tr>
                <td colspan="13" style="text-align:right;background-color:white;">
                    <a href="javascript:void(0);" name="btn_export_search"><i class="glyphicon glyphicon-save"></i> 数据导出</a>
                </td>
            </tr>
        </table>
    </div>
    <!-- /.box-body -->
    <div class="box-footer text-center">
        <@components.pagination "/salemanPayrule/searchList?prodct=${prodct!}&area=${area!}&state=${state!}&page=$page",pagelist.page,pagelist.pageTotal/>
    </div>
</div>


</@layout_default>